package Operation;

import Book.BookList;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:岁亮亮
 * Date:2024-01-14
 * TIME:15:26
 */
public class return1 implements Iooperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("归还图书");
        System.out.println("请输入你要归还的图书");
        Scanner scanner=new Scanner(System.in);
        String name=scanner.nextLine();
        int flag=1;
        for (int i = 0; i < bookList.getUsesize(); i++) {
            if(name.equals(bookList.getbooks(i).getName() )){
                bookList .getbooks(i).setIsbrrowed(false);
                flag=-1;
                System.out.println("借阅成功");
            }
        }
        if(flag==1){
            System.out.println("书架上没有你要归还的图书");
        }
    }
}
